//
//  UIDevice+ssid.m
//  TestGizWits
//
//  Created by JM on 15/11/17.
//  Copyright © 2015年 JM. All rights reserved.
//

#import "UIDevice+ssid.h"
#import <SystemConfiguration/CaptiveNetwork.h>

@implementation UIDevice (ssid)
#pragma mark- 检出ssid 设备在用的
- (NSString *)ssidInUsing {
    NSArray *ifs = (__bridge_transfer NSArray *)CNCopySupportedInterfaces();
    NSDictionary *info = nil;
    NSLog(@"ifs:%@",ifs);
    
    for (NSString *ifnam in ifs) {
        info = (__bridge_transfer NSDictionary *)CNCopyCurrentNetworkInfo((__bridge CFStringRef)ifnam);
        if (info && [info count])
        {
            break;
        }
    }
//    NSLog(@"surrent ssid info:%@",info);
    
    
    NSString *ssid = [info objectForKey:@"SSID"];
    if([ssid hasPrefix:@"XPG-GAgent"])
    {
        //是 Soft-AP 模式
    }
    return ssid;
}
@end
